const fs = require('fs')
const path = require('path')
console.log(__dirname) // 获取当前文件所在路径
console.log(path.join(__dirname, 'test.txt')) // 拼接路径
fs.readFile(path.join(__dirname, 'test.txt'), (error, data) => {
    if (error) console.log(error)
    else console.log(data.toString())
})